import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '请求接口URL',
    align:"center",
    dataIndex: 'requestInterfaceUrl'
   },
   {
    title: '请求参数obj',
    align:"center",
    dataIndex: 'requestParameterObj'
   },
   {
    title: '请求时间',
    align:"center",
    dataIndex: 'requestTime'
   },
  {
     title: '请求第三方类型',
     align: "center",
     dataIndex: 'requestThirdPartyType',
     customRender: ({ text }) => {
       return render.renderDict(text, 'request_third_party_type');
    },
   },
   {
    title: '是否已经成功消费',
    align:"center",
    dataIndex: 'whetherConsume',
    customRender: ({ text }) => {
      return text == 1 ? '是' : text == 0 ? '否' : ''
    },
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '是否OEM',
    align:"center",
    dataIndex: 'oemNot',
    customRender: ({ text }) => {
      return text == 1 ? '是' : text == 0 ? '否' : ''
    },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "请求URL",
    field: "requestInterfaceUrl",
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    label: "请求第三方类型",
    field: "requestThirdPartyType",
    component: 'JDictSelectTag',
    componentProps: {
      showChooseOption:false,
      dictCode: "request_third_party_type"
    },
    colProps: { span: 8 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '请求接口URL',
    field: 'requestInterfaceUrl',
    component: 'Input',
  },
  {
    label: '请求参数obj',
    field: 'requestParameterObj',
    component: 'InputTextArea',
  },
  {
    label: '请求时间',
    field: 'requestTime',
    component: 'InputNumber',
  },
  {
    label: '请求第三方类型',
    field: 'requestThirdPartyType',
    component: 'JDictSelectTag',
    componentProps: {
      showChooseOption:false,
      dictCode: "request_third_party_type"
    },
  },
  {
    label: '是否已经成功消费 0否 1是',
    field: 'whetherConsume',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"yn"
     },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '是否OEM 0否 1是',
    field: 'oemNot',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}